﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;

namespace Framework.Serializer
{
    class JavaScriptSerializer : StringSerializeBase
    {
        static System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();

        public override string Serialize(object obj)
        {
            if (obj == null) return "{}";
            return jss.Serialize(obj);
        }

        public override T DeSerialize<T>(string source)
        {
            return jss.Deserialize<T>(source);
        }
    }
}
